package com.xlh.server.protocol.support.json;

import android.text.Html;
import android.view.View;

import com.xlh.Utils.FontHandler;
import com.xlh.Utils.GsonManager;
import com.xlh.Utils.MudProtocol;
import com.xlh.bean.ProtocolObject.Base;
import com.xlh.bean.ProtocolObject.InputBean;
import com.xlh.interf.IActivity;
import com.xlh.interf.ITakeMessage;

import net.nightwhistler.htmlspanner.HtmlSpanner;

/**
 * 地图
 * // ESA + 011地图
 * Created by mike@Q184377367 on 2018/7/2.
 */

public class MapServer implements ITakeMessage {

    private IActivity atv;
    private String hasType = "map";
    private Base protccoObj;
    public MapServer(IActivity atv){
        this.atv = atv;
    }

    @Override
    public void takeMessage(String t,String s){

        final MapServer me = this;

        if(!t.equals(this.hasType)) return;

        protccoObj =  GsonManager.gsmgr.jsonToAnyObject(s, Base.class);

        if(protccoObj==null ) return;

        FontHandler fontHandler = new FontHandler(this.atv.getActivity());

        //this.atv.getActivity().getTvMap().setText(this.atv.getActivity().getHtmlSpanner().fromHtml(protccoObj.getText()));
       this.atv.getActivity().getTvMap().setText(Html.fromHtml(protccoObj.getText(),null,fontHandler));

        this.atv.getActivity().getmMapLayout().setVisibility(View.VISIBLE);
        this.atv.getActivity().lvFloatRightList.setVisibility(View.GONE);
        this.atv.getActivity().getmAlertGrid().getDataAdapter().clear();
        this.atv.getActivity().getmAlertList().getDataAdapter().clear();
        this.atv.getActivity().closeAlertBox();



    }

    @Override
    public boolean takeMessage(String s) {
        return false;
    }

    @Override
    public void init() {

    }

    @Override
    public void atViewLoadAfterInit(){



    }





}
